home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
comtecelectrical.ca
/
www.comtecelectrical.ca.tar
/
www.comtecelectrical.ca
/
infobots
/
Backup
/
MSOCache
/
All Users
/
90000409-6000-11D3-8CFE-0150048383C9
/
Q2561411.CAB
/
POWERPNT.EXE
/
RCDATA
/
5946
< prev
next >
Wrap
Text File
|
2003-07-30
|
4KB
|
146 lines
/*********************************************
Context menu implementation
_CM() is the function that's hooked up to
the oncontextmenu event. Once we're asked to
show the menu, we first build it by creating
DIVs on-the-fly. Then we position it
within the screen area so it doesn't get
clipped.
Creating the DIVs using createElement() means
we don't have to write out any extra HTML
into the slide HTML files.
**********************************************/
var sNext="^0",sPrev="^1",sEnd="^2",sFont="^3",sArrow="^4",sFreeform="^5",sRect="^6",sOval="^7"
function ShowMenu()
{
BuildMenu();
var doc=PPTSld.document.body,x=PPTSld.event.clientX+doc.scrollLeft,y=PPTSld.event.clientY+doc.scrollTop
m = PPTSld.document.all.item("ctxtmenu")
m.style.pixelLeft=x
if( (x+m.scrollWidth > doc.clientWidth)&&(x-m.scrollWidth > 0) )
m.style.pixelLeft=x-m.scrollWidth
m.style.pixelTop=y
if( (y+m.scrollHeight > doc.clientHeight)&&(y-m.scrollHeight > 0) )
m.style.pixelTop=y-m.scrollHeight
m.style.display=""
}
function _CM()
{
if( !parent.IsFullScrMode() ) return;
if(!PPTSld.event.ctrlKey) {
ShowMenu()
return false
} else
HideMenu()
}
function BuildMenu()
{
if( PPTSld.document.all.item("ctxtmenu") ) return
var mObj=CreateItem( PPTSld.document.body )
mObj.id="ctxtmenu"
mObj.style.visibility="hidden"
var s=mObj.style
s.position="absolute"
s.cursor="default"
s.width="120px"
SetCMBorder(mObj,"menu","black")
var iObj=CreateItem( mObj )
SetCMBorder( iObj, "threedhighlight","threedshadow" )
iObj.style.padding=2
CreateMenuItem( iObj,sNext,M_GoNextSld,M_True )
CreateMenuItem( iObj,sPrev,M_GoPrevSld,M_HasPrevSld )
CreateSeparator( iObj )
CreateMenuItem( iObj,sEnd,M_End,M_True )
mObj.style.visibility="visible"
}
function Cancel() { window.event.cancelBubble=true; window.event.returnValue=false }
function Highlight() { ChangeClr("activecaption","threedhighlight") }
function Deselect() { ChangeClr("threedface","menutext") }
function Perform()
{
e=PPTSld.event.srcElement
if( e.type=="menuitem" && e.IsActive() )
e.Action()
else
PPTSld.event.cancelBubble=true
}
function ChangeClr( bg,clr )
{
e=PPTSld.event.srcElement
if( e.type=="menuitem" && e.IsActive() ) {
e.style.backgroundColor=bg
e.style.color=clr
}
}
function M_HasPrevSld() { return( parent.HasPrevSld() ) }
function M_GoNextSld() { if( gIsEndShow ) M_End(); else GoToNextSld() }
function M_GoPrevSld() { if( gIsEndShow ) { gIsEndShow=0; history.back(); PPTSld.event.cancelBubble=true; } else GoToPrevSld() }
function M_True() { return true }
function M_End() { window.close( self ) }
function CreateMenuItem( node,text,action,eval )
{
var e=CreateItem( node )
e.type="menuitem"
e.Action=action
e.IsActive=eval
e.innerHTML=text
if( !e.IsActive() )
e.style.color="threedshadow"
e.onclick=Perform
e.onmouseover=Highlight
e.onmouseout=Deselect
s=e.style;
s.fontFamily=sFont
s.fontSize="^8"
s.paddingLeft=2
}
function CreateSeparator( node )
{
var sObj=CreateItem( node )
SetCMBorder(sObj,"menu","menu")
var s=sObj.style
s.borderTopColor="threedshadow"
s.borderBottomColor="threedhighlight"
s.height=1
s.fontSize="0px"
}
function CreateItem( node )
{
var elem=PPTSld.document.createElement("DIV")
node.insertBefore( elem )
return elem
}
function SetCMBorder( o,ltClr,rbClr )
{
var s=o.style
s.backgroundColor="menu"
s.borderStyle="solid"
s.borderWidth=1
s.borderColor=ltClr+" "+rbClr+" "+rbClr+" "+ltClr
}